﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BDAlertorApp.Model;

namespace BDAlertorApp.Protocol
{
    public class SendProtocol
    {
        /// <summary>
        /// 查询功能，北斗卡相关信息，设置参数
        /// $CCINQ* FC
        /// </summary>
        /// <returns></returns>
        public static byte[] EncodeINQ()
        {
            string cmd = "\r\n";

            return Encoding.Default.GetBytes(cmd);
        }

        /// <summary>
        /// 北斗卡设置（需要注意，下面的XXXXXXX即为卡号，且必须是7位数，如果不足7位，前面补上0）
        /// 设置成功后返回：CCSTC,OK,卡位*FC
        /// </summary>
        /// <param name="index"></param>
        /// <param name="cardNum"></param>
        /// <returns></returns>
        public static byte[] EncodeSTC(BdCardModel bdCardModel)
        {
            string cmd = "\r\n";

            return Encoding.Default.GetBytes(cmd);
        }

        /// <summary>
        /// 电力工具
        /// 01.获取信息 
        /// </summary>
        /// <param name="index"></param>
        /// <param name="cardNum"></param>
        /// <returns></returns>
        public static byte[] EncodeDL01()
        {
            string cmd = "DEBUG_GETINFO\r\n";

            return Encoding.Default.GetBytes(cmd);
        }

        /// <summary>
        /// 电力工具
        /// 02.初始化设备地址 
        /// </summary>
        /// <param name="index"></param>
        /// <param name="cardNum"></param>
        /// <returns></returns>
        public static byte[] EncodeDL02()
        {
            string cmd = "DEBUG_FORMAT\r\n";

            return Encoding.Default.GetBytes(cmd);
        }

        /// <summary>
        /// 电力工具
        /// 03.设定零位电压值 
        /// </summary>
        /// <param name="ldy">000000</param>
        /// <returns></returns>
        public static byte[] EncodeDL03(int ldy)
        {
            string cmd = "DEBUG_SETMIN="+
                string.Format("{0:D6}", ldy)
                + "\r\n";

            return Encoding.Default.GetBytes(cmd);
        }

        /// <summary>
        /// 电力工具
        /// 04.设定满量程电压值 
        /// </summary>
        /// <param name="mdy">000000</param>
        /// <returns></returns>
        public static byte[] EncodeDL04(int mdy)
        {
            string cmd = "DEBUG_SETMAX=" +
                string.Format("{0:D6}", mdy)
                + "\r\n";

            return Encoding.Default.GetBytes(cmd);
        }

        /// <summary>
        /// 电力工具
        /// 05.启动零位校验 
        /// </summary>
        /// <param name="mdy">000000</param>
        /// <returns></returns>
        public static byte[] EncodeDL05()
        {
            string cmd = "DEBUG_CALIBZERO\r\n";

            return Encoding.Default.GetBytes(cmd);
        }

        /// <summary>
        /// 电力工具
        /// 06.启动满量程校验 
        /// </summary>
        /// <param name="mdy">000000</param>
        /// <returns></returns>
        public static byte[] EncodeDL06()
        {
            string cmd = "DEBUG_CALIBFULL\r\n";

            return Encoding.Default.GetBytes(cmd);
        }

        /// <summary>
        /// 电力工具
        /// 07.显示实时液位值 
        /// </summary>
        /// <param name="mdy">000000</param>
        /// <returns></returns>
        public static byte[] EncodeDL07()
        {
            string cmd = "DEBUG_LOGEN\r\n";

            return Encoding.Default.GetBytes(cmd);
        }

        /// <summary>
        /// 卡号删除
        /// 删除成功后返回：CCDEL,OK,卡位*FC
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public static byte[] EncodeDEL(int index)
        {
            string cmd = "\r\n";

            return Encoding.Default.GetBytes(cmd);
        }

        /// <summary>
        /// 播报设置
        /// 	语音播报和mp3播报标志， 0：关闭，1:开启
        /// </summary>
        /// <param name="voiceFlag"></param>
        /// <param name="mp3Flag"></param>
        /// <param name="vol">1 -5 </param>
        /// <returns></returns>
        public static byte[] EncodeSTP(int voiceFlag,int mp3Flag, int vol)
        {
            string cmd = "\r\n";

            return Encoding.Default.GetBytes(cmd);
        }

    }
}
